//
//  MineHabitViewController.m
//  baodongPro
//
//  Created by feng on 16/2/29.
//  Copyright © 2016年 proper. All rights reserved.
//



#import "MineHabitViewController.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "FBDTableViewCell.h"
@interface MineHabitViewController ()<UITableViewDataSource,UITableViewDelegate>
{
    UITableView* _myTableView;
    NSMutableArray* _urlArray;

}
@end

@implementation MineHabitViewController


-(void)viewDidLoad
{
    [super viewDidLoad];
    
    
    _urlArray=[NSMutableArray array];
    [_urlArray addObject:@"http://v1.qzone.cc/avatar/201303/19/00/46/514744dbd9c44901.jpg%21200x200.jpg"];
    [_urlArray addObject:@"https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=4168762024,1922499492&fm=21&gp=0.jpg"];
    [_urlArray addObject:@"https://ss0.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1480985633,1206349730&fm=21&gp=0.jpg"];
    [_urlArray addObject:@"https://ss0.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=546811603,943746655&fm=21&gp=0.jpg"];
    [_urlArray addObject:@"http://v1.qzone.cc/avatar/201303/19/00/46/514744dbd9c44901.jpg%21200x200.jpg"];
    [_urlArray addObject:@"https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=4168762024,1922499492&fm=21&gp=0.jpg"];
    [_urlArray addObject:@"https://ss0.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1480985633,1206349730&fm=21&gp=0.jpg"];
    [_urlArray addObject:@"https://ss0.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=546811603,943746655&fm=21&gp=0.jpg"];
    [_urlArray addObject:@"http://v1.qzone.cc/avatar/201303/19/00/46/514744dbd9c44901.jpg%21200x200.jpg"];
    [_urlArray addObject:@"https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=4168762024,1922499492&fm=21&gp=0.jpg"];
    [_urlArray addObject:@"https://ss0.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1480985633,1206349730&fm=21&gp=0.jpg"];
    [_urlArray addObject:@"https://ss0.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=546811603,943746655&fm=21&gp=0.jpg"];
    [_urlArray addObject:@"http://v1.qzone.cc/avatar/201303/19/00/46/514744dbd9c44901.jpg%21200x200.jpg"];
    [_urlArray addObject:@"https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=4168762024,1922499492&fm=21&gp=0.jpg"];
    [_urlArray addObject:@"https://ss0.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=1480985633,1206349730&fm=21&gp=0.jpg"];
    [_urlArray addObject:@"https://ss0.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=546811603,943746655&fm=21&gp=0.jpg"];
    _myTableView=[self.view fbd_quickCreateUITabdWithleViewFrame:CGRectMake(0, 0, ScreenW, screenH-NavTop) andDelegateAndDataSource:self];
    _myTableView.rowHeight=80;
    _myTableView.backgroundColor=[UIColor brownColor];
    [self.containedView addSubview:_myTableView];
    

    [_myTableView reloadData];
    
    

}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

    return _urlArray.count;
}

// Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier:
// Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls)

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{

    static NSString* identifier=@"myCells";
    FBDTableViewCell* cell=[tableView dequeueReusableCellWithIdentifier:identifier];
    
    if (!cell)
    {
        cell=[[FBDTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier withFrame:CGRectMake(0, 0, ScreenW, 80)];
    
    }

    NSString* indexUrl=[_urlArray objectAtIndex:indexPath.row];
    
    [cell.leftImageView sd_setImageWithURL:[NSURL URLWithString:indexUrl]];
    
    cell.rightLabel.text=indexUrl;
    cell.rightLabel.backgroundColor=[UIColor clearColor];
//    if (indexPath.row%2==1)
//    {
//        cell.rightLabel.backgroundColor=[UIColor yellowColor];
//        
//        
//    }else{
//    
//    cell.rightLabel.backgroundColor=[UIColor redColor];
//    
//    }
    
    return cell;

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
